import React, { Component } from 'react'
import bus from '../util/eventbus'

export default class Middle extends Component {
  getBrotherData=(msg)=>{
    console.log('Middle组件接受一方的函数',msg);
  }
  componentDidMount(){
    //在该生命周期方法中完成监听
    bus.addListener('e1',this.getBrotherData)
  }
  render() {
    return (
      <div style={{flexGrow:1,backgroundColor:'springgreen',height:'100vh'}}>
        <h1>Middle</h1>
      </div>
    )
  }
}
